package com.example.mymall.repository.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.mymall.dao.ShopcartMapper;
import com.example.mymall.entity.ShopcartEntity;
import com.example.mymall.entity.UserEntity;
import com.example.mymall.entity.UserGoodsCartVO;
import com.example.mymall.repository.ShopcartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import java.util.List;

@Service
public class ShopcartServiceImpl extends ServiceImpl<ShopcartMapper,ShopcartEntity> implements ShopcartService {
    @Autowired
    private ShopcartMapper shopcartMapper;

    public IPage<UserGoodsCartVO> getCartDetailAll(int currentPage, int pageSize){
        Page<UserGoodsCartVO> page = new Page<>(currentPage, pageSize);
        if(shopcartMapper.selectCartDetailAll(page) == null){
            System.out.println("is null");
        }else {
            System.out.println("not null");
        }
        return shopcartMapper.selectCartDetailAll(page);
    }
//
    public List<UserGoodsCartVO> test() {
        return shopcartMapper.selecttext();
    }


//    public List<ShopcartEntity> getCart(){
//        return shopcartMapper.selectCart();
//    }


}
